package com.larry.spring.bean;

import lombok.Data;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

/**
 * @ProjectName spring
 * @Author larry
 * @Date 15:32 2021/9/2
 * @Description TODO
 **/

@Component
public class Person {

	private String username;

	//@Autowired
	private Cat cat;

	//依赖关系  在容器中找
	@Lookup
	public Cat getCat() {
		return cat;
	}


	public void setCat(Cat cat) {
		this.cat = cat;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Override
	public String toString() {
		return "Person{" +
				"username='" + username + '\'' +
				'}';
	}
}
